/**
 * 
 */
package com.jbat.gwt.tiledmapcreator.client.activities;

import com.jbat.gwt.tiledmapcreator.client.places.MapDesignPlace;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.google.inject.Inject;

/**
 * 
 */
public class TileSetActivityMapper implements ActivityMapper {
  /**
   * Factory method for injecting the correct activity given a place.
   */
  public interface Factory {
    TileSetActivity showTiles(MapDesignPlace place);
  }
  
  @Inject
  private Factory factory;

  /*
   * (non-Javadoc)
   * 
   * @see com.google.gwt.activity.shared.ActivityMapper#getActivity(com.google.
   * gwt.place.shared.Place)
   */
  @Override
  public Activity getActivity(Place place) {
    Activity returnActivity = null;

    if (place instanceof MapDesignPlace) {
      returnActivity = factory.showTiles((MapDesignPlace) place);
    }

    return returnActivity;
  }

}
